import request from '@/utils/request';

// 获取商品分页列表
export async function reqProducts({ payload }): Promise<any> {
  return request('/api/manage/product/list', {
    ...payload,
  });
}

// 获取商品搜索分页列表
export async function reqSearchProducts({ payload }): Promise<any> {
  return request('/api/manage/product/search', {
    ...payload,
  });
}

// 更新商品状态 上架/下架
export async function reqUpdateStatus({ payload }): Promise<any> {
  return request('/api/manage/product/updateStatus', {
    method: 'POST',
    ...payload,
  });
}

// 根据分类id 获取分类名称
export async function reqCategoryName({ payload }): Promise<any> {
  return request('/api/manage/category/info', {
    ...payload,
  });
}

// 删除图片
export async function reqDeleteImg({ payload }): Promise<any> {
  return request('/api/manage/img/delete', {
    method: 'POST',
    ...payload,
  });
}

// 添加商品
export async function reqAddProduct({ payload }): Promise<any> {
  return request('/api/manage/product/add', {
    method: 'POST',
    ...payload,
  });
}

// 修改商品
export async function reqUpdateProduct({ payload }): Promise<any> {
  return request('/api/manage/product/update', {
    method: 'POST',
    ...payload,
  });
}
